package com.lighthouse.doc.comment.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Builder;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 文档-用户评论关联对象 lh_rel_doc_comment
 * 
 * @author ysz
 * @date 2023-05-10
 */
//@Builder
@Data
public class KnowledgeDocCommentVO extends KnowledgeDocComment
{
    private static final long serialVersionUID = 1L;

    /** 当前评论是否为当前用户所有 */
    private boolean owner;

    private String content;

    private String avatarUrl;

    private String nickName;

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private LocalDateTime createTime;

    public boolean isOwner() {
        return owner;
    }

    public void setOwner(boolean owner) {
        this.owner = owner;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getAvatarUrl() {
        return avatarUrl;
    }

    public void setAvatarUrl(String avatarUrl) {
        this.avatarUrl = avatarUrl;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    @Builder(builderMethodName = "docCommentVO")
    public KnowledgeDocCommentVO(String commentId, String docId, Long userId, String commentInfo, String isDelete, Long sort, String parentId, boolean owner, String content, String avatarUrl, String nickName, LocalDateTime createTime) {
        super(commentId, docId, userId, commentInfo, isDelete, sort, parentId, createTime);
        this.owner = owner;
        this.content = content;
        this.avatarUrl = avatarUrl;
        this.nickName = nickName;
    }

    public KnowledgeDocCommentVO(String commentId, String docId, Long userId, String commentInfo, String isDelete, Long sort, String parentId, LocalDateTime createTime) {
        super(commentId, docId, userId, commentInfo, isDelete, sort, parentId, createTime);
    }

    public KnowledgeDocCommentVO() {
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("commentId", getCommentId())
            .append("docId", getDocId())
            .append("userId", getUserId())
            .append("commentInfo", getCommentInfo())
            .append("isDelete", getIsDelete())
            .append("sort", getSort())
            .append("parentId", getParentId())
            .append("createTime", getCreateTime())
            .toString();
    }
}
